package com.fyzk.activity.prize.detail;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.fyzk.activity.prize.item.PrizeItemBase;
import com.tyjc.lottery.R;

public class PrizeSelectDetailTopView extends RelativeLayout {
	private Context mContext;
	private TextView mTxt_period;
	private TextView mTxt_date;
//	private TextView mTxt_lotteryName;
	private LinearLayout mTxt_nums;

	public PrizeSelectDetailTopView(Context context) {
		this(context, null);
	}

	public PrizeSelectDetailTopView(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
	}

	public PrizeSelectDetailTopView(Context context, AttributeSet attrs,
			int defStyle) {
		super(context, attrs, defStyle);
		mContext = context;
		View.inflate(mContext, R.layout.ttc_layout_prizeselect_detail_top, this);
		initView();
	}

	private void initView() {
		mTxt_period = (TextView) findViewById(R.id.ttc_layout_prizedetail_txt_peroid);
		mTxt_date = (TextView) findViewById(R.id.ttc_layout_prizedetail_txt_date);
//		mTxt_lotteryName = (TextView) findViewById(R.id.ttc_layout_prizedetail_txt_lotteryName);
		mTxt_nums = (LinearLayout) findViewById(R.id.ttc_layout_prizedetail_txt_numball);
	}

	public void setLotteryName(String lotteryID) {
//		mTxt_lotteryName.setText(lotteryID);
	}

	public void setPeriod(String period) {
		StringBuffer period_sb = new StringBuffer();
		period_sb.append(mContext.getString(R.string.text_di_qi, period));
		mTxt_period.setText(period_sb.toString());
	}

	public void setDate(String date) {
		if(TextUtils.isEmpty(date)){
			return;
		}
		mTxt_date.setText(date);
	}

	public void setPrizeNum(PrizeItemBase prizeItem) {
		mTxt_nums.removeAllViews();
		prizeItem.initNumView(mTxt_nums);
	}

}
